package cn.tedu;

import java.sql.*;
import java.util.Scanner;

public class Demo09 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        System.out.println("请输入球员姓名");
        String playername=scan.nextLine();
        System.out.println("请输入球队名称");
        String teamname=scan.nextLine();

        try(Connection conn=DBUtils.getCoon()) {

           String sql ="insert into user values(null,?,?)";


            PreparedStatement ps= conn.prepareStatement(sql);
            //            替换SQL语句中的？
            ps.setString(1,playername);
            ps.setString(2,teamname);

            ps.executeUpdate();
            System.out.println("保存成功！");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }


    }
}
